﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Agent
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            //routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
            
            //root.txt

            routes.MapRoute("root.txt", "root.txt", new { controller = "Home", action = "root" });

            #region login
            routes.MapRoute(null, "login.html", new { controller = "Login", action = "Index" });
            routes.MapRoute("postlogin.html", "postlogin.html", new { controller = "Login", action = "Login" });
            routes.MapRoute(null, "verify.html", new { controller = "Login", action = "VerifyCodeImage" });

            #endregion

            #region 代理
            //代理中心
            routes.MapRoute(null, "Agent.html", new { controller = "agentcenter", action = "index" });

            routes.MapRoute("ApplyAgent.html", "ApplyAgent.html", new { controller = "Agent", action = "Apply" });

            routes.MapRoute("ApplyOrder.html", "ApplyOrder.html", new { controller = "Agent", action = "Order" });

            routes.MapRoute("tx.html", "tx.html", new { controller = "Agent", action = "TX" });

            routes.MapRoute("TXRecord.html", "TXRecord.html", new { controller = "Agent", action = "TXRecord" });

            routes.MapRoute("HZ.html", "HZ.html", new { controller = "Agent", action = "HZ" });

            routes.MapRoute("QrCode.html", "QrCode.html", new { controller = "Agent", action = "QrCode" });


            routes.MapRoute("Huoban.html", "Huoban.html", new { controller = "Agent", action = "Huoban" });



            #endregion


            #region 网站
            routes.MapRoute(null, "{aid}/index.html", new { controller = "Home", action = "Index", aid = "" });
            //routes.MapRoute(null, "{aid}", new { controller = "Home", action = "Index", aid = "" });

            routes.MapRoute(null, "cp_tkl/{tkl}", new { controller = "Home", action = "T" });
            #endregion


            #region Product
            //routes.MapRoute(null, "{aid}/c_{cid}.html", new { controller = "Product", action = "List", cid = "0", aid = "" });
            //routes.MapRoute(null, "{aid}/9.9.html", new { controller = "Product", action = "List", id = "9", aid = "" });
            //routes.MapRoute(null, "{aid}/19.9.html", new { controller = "Product", action = "List", id = "19", aid = "" });
            //routes.MapRoute(null, "{aid}/sc.html", new { controller = "Product", action = "List", aid = "" });

            //routes.MapRoute(null, "{aid}/goods.html", new { controller = "Product", action = "Goods", aid = "" });
            //routes.MapRoute(null, "{aid}/p_{id}.html", new { controller = "Product", action = "Detail", id = "0", aid = "" });
            //routes.MapRoute(null, "Collect.html", new { controller = "Product", action = "CollectAdd" });
            //routes.MapRoute(null, "{aid}/cart.html", new { controller = "Product", action = "CollectList", aid = "" });
            //routes.MapRoute(null, "open.html", new { controller = "Product", action = "opentao" });
            //routes.MapRoute(null, "{aid}/Nine.html", new { controller = "Home", action = "Nine",aid="" });
            // routes.MapRoute(null, "{aid}/GetProductList.html", new { controller = "Home", action = "GetProductList",aid="" });

            routes.MapRoute("agentproduct.html", "agentproduct.html", new { controller = "Agent", action = "Product" });


            #endregion
            //模板二
            routes.MapRoute("agent", "shop/{agent}.html", new { controller = "Home", action = "index" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/getZhekouListByCate.html", new { controller = "Home", action = "getZhekouListByCate" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/goods/{id}.html", new { controller = "Home", action = "Detail", id = "0" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/9.9.html", new { controller = "Home", action = "Nine" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/last.html", new { controller = "Home", action = "last" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/search.html", new { controller = "Home", action = "search" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/getProductList.html", new { controller = "Home", action = "getProductList" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/QRImg.html", new { controller = "Home", action = "GetQRImg" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/GetKouling.html", new { controller = "Home", action = "GetKouling" }, new { agent = @"^\w{2,10}$" });
            routes.MapRoute(null, "{agent}/Topic.html", new { controller = "Home", action = "Topic" }, new { agent = @"^\w{2,10}$" });


            routes.MapRoute(null, "u/login.html", new { controller = "Login", action = "Index" });
            routes.MapRoute(null, "u", new { controller = "AgentCenter", action = "Index" });
            routes.MapRoute(null, "u/getDLProduct.html", new { controller = "AgentCenter", action = "DLProduct" });
            routes.MapRoute(null, "u/goods.html", new { controller = "AgentCenter", action = "Goods" });
            routes.MapRoute(null, "u/kl.html", new { controller = "AgentCenter", action = "Kouling" });
            routes.MapRoute(null, "u/QR.html", new { controller = "AgentCenter", action = "GetQRImg" });

            routes.MapRoute(null, "u/userupdate.html", new { controller = "AgentCenter", action = "userupdate" });
            routes.MapRoute(null, "u/info.html", new { controller = "AgentCenter", action = "UserInfo" });
            routes.MapRoute(null, "u/pwd.html", new { controller = "AgentCenter", action = "PasswordEdit" });
            routes.MapRoute(null, "u/UpdatePwd.html", new { controller = "AgentCenter", action = "UpdatePwd" });
            routes.MapRoute(null, "u/good.html", new { controller = "AgentCenter", action = "Product" });
            routes.MapRoute(null, "u/Search.html", new { controller = "AgentCenter", action = "Search" });
            routes.MapRoute(null, "u/s.html", new { controller = "AgentCenter", action = "SearchKeyWord" });
            routes.MapRoute(null, "u/SearchKl.html", new { controller = "AgentCenter", action = "SearchKl" });
            
            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}
